<template>
  <div class="container">
    <!-- 头部渐变背景   -->
    <div class="bg-color" :style="{backgroundImage:'linear-gradient('+ bgColor +' 20%, #f5f5f5 80%)'}"></div>
    <div class="">
      <!-- 分销商品 确认订单 -->
      <distribution-type v-if="showDistribution"></distribution-type>
      <!-- 社团 门店商品 确认订单 -->
      <other-type v-else></other-type>
    </div>
  </div>
</template>

<script>
import DistributionType from './components/DistributionType.vue'
import OtherType from './components/OtherType.vue'
export default {
  components: {DistributionType, OtherType},
  data() {
    return {
      bgColor: '#FF243D',
      isEffective: 0, // 是否只有物流商品
      groupBuyAuthority: 0, // 是否开启社区
      storeHomeAuthority: 0, // 是否开启门店
      communityDistributionAuthority: 0, // 是否开启社群分销
      appInfo: {},
      featuresType: 13, // 11社区团购 12门店到家 13社群分销(默认)
      showDistribution: false // 是否走社群分销流程
    }
  },
  onShow() {
    this.initPage()
  },
  mounted() {
    this.initPage()
  },
  methods: {
    initPage() {
      this.showDistribution = false
      this.isEffective = this.getCurrentPage().query.isEffective * 1
      // 获取增值功能
      this.appInfo = this.$pt.getStorageSync('appInfo')
      this.groupBuyAuthority = this.appInfo.groupBuyAuthority * 1
      this.storeHomeAuthority = this.appInfo.storeHomeAuthority * 1
      this.communityDistributionAuthority = this.appInfo.communityDistributionAuthority * 1
      this.featuresType = Number(this.getCurrentPage().query.featuresType)
      console.log('test:' + this.featuresType)
      if ((!this.groupBuyAuthority && !this.storeHomeAuthority) || (this.communityDistributionAuthority && this.featuresType === 13)) {
        this.showDistribution = true
      }
      wx.setNavigationBarColor({
        frontColor: '#ffffff',
        backgroundColor: '#FF243D'
      })
    }
  }
}
</script>

<style  lang="less" scoped>
  .container {
    padding-left: 15px;
    padding-right: 15px;
    // padding-bottom: 60px;
    box-sizing: border-box;
    .bg-color {
      height: 246px;
      // padding: 16px 10px 16px 10px;
      box-sizing: border-box;
      position: absolute;
      width: 100%;
      top: 0;
      left: 0;
      z-index: -1;
    }
  }
</style>